import QuickTool from '@/utils/Engineering/QuickTool';
import { host } from '@/utils/web.domain.config';
import { maintableOperateExpandList } from '../main.data';

const operationList = [
  'handleOperaateJump',
  'handleModalEdit',
  'handleSingleCopy',
  'handleQuickEdit',
  'handleSingleQuickEdit',
  'handleModalSubmit',
  'handleSingleDelete',
];

const apiPath = {
  submitDataBaseURL: '/api/common/sys_query_set',
  getDatasourceURL: `/api/common/sys_query_set/page`,
  basis: 'id',
};
const extraData = {
  __sent_data_diff_cover_field: '',
};

const pagination = { pageSize: 10, current: 1 };

const popupForm = {
  open_type: 'Drawer',
  width: '65%',
};

const fieldList = [
  {
    form_type: 'Input',
    title_or_label: '字段名',
    dataIndex_or_field: 'field_name',
    key: 'field_name',
    placeholder: '',
    fixed: 'left',
    width: 160,
    col: 12,
    initialValue: '',
    list: [],
  },
  {
    form_type: 'Input',
    title_or_label: QuickTool.tooltip({ title: 'UUID代码', help: '查询表格代码', required: true }),
    dataIndex_or_field: 'sys_table_set_code',
    key: 'sys_table_set_code',
    placeholder: '',
    width: 160,
    col: 12,
    initialValue: '',
    list: [],
  },
  {
    form_type: 'Input',
    title_or_label: QuickTool.tooltip({
      title: '字段代码',
      help: '命名规则:以字母开头，特殊字符不可用，可以使用下划线、数字',
      required: true,
    }),
    dataIndex_or_field: 'field_code',
    key: 'field_code',
    placeholder: '',
    width: 160,
    col: 12,
    initialValue: '',
    list: [],
  },
  {
    form_type: 'Select',
    title_or_label: QuickTool.tooltip({ title: '值类型', help: '值类型' }),
    dataIndex_or_field: 'value_type',
    key: 'value_type',
    placeholder: '',
    width: 160,
    col: 12,
    initialValue: '',
    list: [
      { value: '字符', name: '字符' },
      { value: '数值', name: '数值' },
    ],
  },
  {
    form_type: 'Select',
    title_or_label: QuickTool.tooltip({ title: '数据来源', help: '数据来源' }),
    dataIndex_or_field: 'value_source',
    key: 'value_source',
    placeholder: '',
    width: 160,
    col: 12,
    initialValue: '',
    list: [
      { value: '词典定义', name: '词典定义' },
      { value: 'API', name: 'API' },
    ],
  },
  {
    form_type: 'Input',
    title_or_label: QuickTool.tooltip({ title: '默认值', help: '默认值' }),
    dataIndex_or_field: 'default_value',
    key: 'default_value',
    placeholder: '',
    width: 160,
    col: 12,
    initialValue: '',
    list: [
      { value: '词典定义', name: '词典定义' },
      { value: 'API', name: 'API' },
    ],
  },
  {
    form_type: 'Input',
    title_or_label: QuickTool.tooltip({ title: '选择词典代码', help: '选择词典代码' }),
    dataIndex_or_field: 'blade_dict_code',
    key: 'blade_dict_code',
    placeholder: '',
    width: 160,
    col: 12,
    initialValue: '',
    list: [],
  },
  {
    form_type: 'Select',
    title_or_label: QuickTool.tooltip({ title: '前端输入类型', help: '前端输入类型' }),
    dataIndex_or_field: 'entry_type_map',
    key: 'entry_type_map',
    placeholder: '',
    width: 160,
    col: 12,
    initialValue: '',
    list: [
      { value: 'Input', name: 'Input' },
      { value: 'InputNumber', name: 'InputNumber' },
      { value: 'Select', name: 'Select' },
      { value: 'Select_multiple', name: 'Select_multiple' },
      { value: 'Select_tag', name: 'Select_tag' },
      { value: 'DatePicker', name: 'DatePicker' },
      { value: 'TreeSelect', name: 'TreeSelect' },
      { value: 'Radio', name: 'Radio' },
    ],
  },
  {
    form_type: 'Input',
    title_or_label: QuickTool.tooltip({ title: '数据源API地址', help: '数据源API地址' }),
    dataIndex_or_field: 'datasource_url',
    key: 'datasource_url',
    placeholder: '',
    width: '',
    col: 24,
    initialValue: '',
    list: [],
  },
];

const tableOperateExpandList = [
  maintableOperateExpandList.FormFieldSetting,
  maintableOperateExpandList.TableFieldSettting,
];

const initialSearchList = [
  { ...fieldList[1], col: 6 },
  { ...fieldList[0], col: 6 },
  { ...fieldList[2], col: 6, title_or_label: '字段代码' },
  { form_type: '__operate', custom_sort: false },
  { ...fieldList[3], col: 6 },
];

const dataSource: Array<any> = [];

export {
  fieldList,
  initialSearchList,
  dataSource,
  apiPath,
  tableOperateExpandList,
  pagination,
  extraData,
  operationList,
  popupForm,
};
